package com.ylxn.chapter01;

import java.util.concurrent.Callable;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.FutureTask;

public class demo03 {
    public static void main(String[] args) throws ExecutionException, InterruptedException {
        Callable<Integer> callable = new Callable<Integer>() {
            @Override
            public Integer call() throws Exception {
                System.out.println("callable ....");
                return 1;
            }
        };
        FutureTask<Integer> task = new FutureTask<>(callable);
        new Thread(task,"callable").start();
        System.out.println(task.get());
    }
}
